/*
 *  $Id: ObjectHistoryUserDateCompare.java,v 1.3 2006/04/06 20:26:55 vectrics Exp $
 */
package org.vectrics.history;


import java.util.*;




/**
 *  Description of the Class
 *
 *@author     mmoore
 *@created    December 26, 2002
 */
public class ObjectHistoryUserDateCompare implements Comparator {

    /**
     *  Constructor for the JobDeviceDateComparator object
     */
    public ObjectHistoryUserDateCompare() { }


    /**
     *  Description of the Method
     */
    public int compare(Object object1, Object object2) {
        ObjectHistory obj1 = (ObjectHistory) object1;
        ObjectHistory obj2 = (ObjectHistory) object2;

        int result = 0;
        try {
            result = obj1.getObjectType().compareTo(obj2.getObjectType());
            
            if (result == 0) {
                result = obj1.getPerson().getName().compareTo(obj2.getPerson().getName());
            }
            
            if (result == 0) {
                result = obj1.getObjectId().compareTo(obj2.getObjectId());
            }
            
            if (result == 0) {
                result = obj1.getDate().compareTo(obj2.getDate());
            }
			if (result == 0) {
				result = obj1.getId().compareTo(obj2.getId());
			}
        }
        catch (Exception ex) {
            
        }
        return (result);
    }
}

